$OpenBSD: patch-libnetutil_netutil_cc,v 1.6 2014/06/16 10:22:15 sthen Exp $

first chunk:
http://marc.info/?l=openbsd-ports&m=140284432321370&w=2

similar diff to DLT_LINUX_SLL chunks sent upstream but they seem uninterested.
http://marc.info/?l=nmap-dev&m=140179174718457&w=2

chunks dealing with iovec: ???

--- libnetutil/netutil.cc.orig	Thu Nov  7 19:32:33 2013
+++ libnetutil/netutil.cc	Sun Jun 15 20:36:36 2014
@@ -916,7 +916,7 @@ void set_ttl(int sd, int ttl) {
 /* Other than WIN32, what these systems have in common is that they use BPF for
    packet capture. (Solaris 10 and earlier used DLPI and had valid selectable
    fds.) */
-#if defined(WIN32) || defined(MACOSX) || (defined(FREEBSD) && (__FreeBSD_version < 500000) || defined(SOLARIS_BPF_PCAP_CAPTURE))
+#if defined(WIN32) || defined(MACOSX) || defined(OPENBSD) || (defined(FREEBSD) && (__FreeBSD_version < 500000) || defined(SOLARIS_BPF_PCAP_CAPTURE))
 /* Returns whether the system supports pcap_get_selectable_fd() properly */
 int pcap_selectable_fd_valid() {
   return 0;
@@ -3140,7 +3140,6 @@ static int route_dst_netlink(const struct sockaddr_sto
                              const struct sockaddr_storage *spoofss) {
   struct sockaddr_nl snl;
   struct msghdr msg;
-  struct iovec iov;
   struct nlmsghdr *nlmsg;
   struct rtmsg *rtmsg;
   struct rtattr *rtattr;
@@ -3192,22 +3191,14 @@ static int route_dst_netlink(const struct sockaddr_sto
     add_rtattr_addr(nlmsg, &rtattr, &len, RTA_SRC, spoofss, intf_index);
   }
 
-  iov.iov_base = nlmsg;
-  iov.iov_len = nlmsg->nlmsg_len;
-
   memset(&msg, 0, sizeof(msg));
   msg.msg_name = &snl;
   msg.msg_namelen = sizeof(snl);
-  msg.msg_iov = &iov;
-  msg.msg_iovlen = 1;
 
   rc = sendmsg(fd, &msg, 0);
   if (rc == -1)
     netutil_fatal("%s: cannot sendmsg: %s", __func__, strerror(errno));
 
-  iov.iov_base = buf;
-  iov.iov_len = sizeof(buf);
-
   len = recvmsg(fd, &msg, 0);
   if (len <= 0)
     netutil_fatal("%s: cannot recvmsg: %s", __func__, strerror(errno));
@@ -3838,7 +3829,6 @@ static const unsigned char *add_exthdr_ancillary(struc
 static int send_ipv6_ip(const struct sockaddr_in6 *dst,
   const unsigned char *packet, size_t packetlen) {
   struct msghdr msg;
-  struct iovec iov;
 
   const unsigned char *end;
   struct ip6_hdr *hdr;
@@ -3854,8 +3844,6 @@ static int send_ipv6_ip(const struct sockaddr_in6 *dst
   /* Set up sendmsg data structure. iov is filled in below. */
   msg.msg_name = (void *) dst;
   msg.msg_namelen = sizeof(*dst);
-  msg.msg_iov = &iov;
-  msg.msg_iovlen = 1;
   msg.msg_control = NULL;
   msg.msg_controllen = 0;
   msg.msg_flags = 0;
@@ -3914,8 +3902,6 @@ static int send_ipv6_ip(const struct sockaddr_in6 *dst
   }
 
   assert(packet <= end);
-  iov.iov_base = (unsigned char *) packet;
-  iov.iov_len = end - packet;
 
   n = sendmsg(sd, &msg, 0);
   if (n == -1)
@@ -4084,9 +4070,6 @@ int datalink_offset(int datalink)
 {
   if (datalink == DLT_EN10MB)
     return ETH_HDR_LEN;
-  else if (datalink == DLT_LINUX_SLL)
-    /* The datalink type is Linux "cooked" sockets. See pcap-linktype(7). */
-    return 16;
   else
     return -1;
 }
@@ -4123,7 +4106,7 @@ static int read_reply_pcap(pcap_t *pd, long to_usec,
     netutil_fatal("Cannot obtain datalink information: %s", pcap_geterr(pd));
   ioffset = datalink_offset(*datalink);
   if (ioffset < 0)
-    netutil_fatal("datalink_offset failed for type %d (DLT_EN10MB = %d, DLT_LINUX_SLL = %d)", *datalink, DLT_EN10MB, DLT_LINUX_SLL);
+    netutil_fatal("datalink_offset failed for type %d (DLT_EN10MB = %d)", *datalink, DLT_EN10MB);
   *offset = (unsigned int) ioffset;
 
   if (to_usec > 0) {
@@ -4223,10 +4206,6 @@ static bool accept_arp(const unsigned char *p, const s
 
   if (datalink == DLT_EN10MB) {
     return ntohs(*((u16 *) (p + 12))) == ETH_TYPE_ARP;
-  } else if (datalink == DLT_LINUX_SLL) {
-    return ntohs(*((u16 *) (p + 2))) == ARPHRD_ETHER && /* sll_hatype */
-      ntohs(*((u16 *) (p + 4))) == 6 && /* sll_halen */
-      ntohs(*((u16 *) (p + 14))) == ETH_TYPE_ARP; /* sll_protocol */
   } else {
     return false;
   }
